<html>
<head>
<title>Magneato Internal Error</title>
<link href="<%= request.getContextPath() %>/css/admin.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<h1>Ooops! Internal error</h1>
<fieldset>

<%
	try {
		// The Servlet spec guarantees this attribute will be available
		Throwable exception = (Throwable) request
				.getAttribute("javax.servlet.error.exception");

		if (exception != null) {
			if (exception instanceof ServletException) {
				// It's a ServletException: we should extract the root cause
				ServletException sEx = (ServletException) exception;
				Throwable rootCause = sEx.getRootCause();
				if (rootCause == null)
					rootCause = sEx;
				out.println("** Root cause is: "
						+ rootCause.getMessage());
				rootCause.printStackTrace(new java.io.PrintWriter(out));
			} else {
				// It's not a ServletException, so we'll just show it
%>
<pre>
<%				exception.printStackTrace(new java.io.PrintWriter(out)); %>
</pre>
<%			}
		} else {
			out.println("No error information available");
		}

		// Display cookies
		out.println("\nCookies:\n");
		Cookie[] cookies = request.getCookies();
		if (cookies != null) {
			for (int i = 0; i < cookies.length; i++) {
				out.println(cookies[i].getName() + "=["
						+ cookies[i].getValue() + "]");
			}
		}

	} catch (Exception ex) {
		ex.printStackTrace(new java.io.PrintWriter(out));
	}
%>
</fieldset>
<div align="center">
<a href="http://www.magneato.org/"><img src="<%= request.getContextPath() %>/css/images/logo.png" alt="Powered by Magneato" border="0"/></a>
</div>
</body>
</html>
